package com.ruoyi.customer.controller;

import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.uuid.UUID;
import com.ruoyi.customer.dto.AttachmentInfo;
import com.ruoyi.customer.service.FileUploadService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.PostConstruct;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.Arrays;

@RestController
@RequestMapping("/amac/departmentMerit/upload")
@RequiredArgsConstructor
public class FileUploadController {
    //private final DepartmentMeritAttachmentService attachmentService;


    @Autowired
    private FileUploadService fileUploadService;


    @PostMapping("/attachment")
    public AjaxResult uploadAttachment(@RequestParam("file") MultipartFile file) throws Exception {
        return AjaxResult.success(fileUploadService.uploadAttachment(file));
    }
}
